package com.stox.ui.javafx.core.application;

import java.util.Collection;
import java.util.Locale;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

import com.stox.dto.intf.Application;

@Component
@Lazy(true)
public class MyApplicationsTab extends AbstractApplicationTab {

	@Autowired
	public void setMessageSource(MessageSource messageSource){
		setText(messageSource.getMessage("MyApps", null, Locale.getDefault()));
	}
	
	@Autowired
	public void setApplicationContext(ApplicationContext applicationContext){
		this.applicationContext = applicationContext;
		Collection<Application> applications = applicationContext.getBeansOfType(Application.class).values();
		for(Application application : applications){
			addApplication(application);
		}
	}
}
